<template>
    <div id="root">
        <h1>人员列表</h1>
        <h2 style="color: red;">HelloWorld 组件的求和为{{ sum }}</h2>
        <input type="text" placeholder="输入人员姓名" v-model="name" />
        <button @click=ADD_PRESON(name)>添加</button>
        <ul>
            <li v-for="preson in presonList" :key="preson.id"> {{ preson.name }}</li>
        </ul>
    </div>
</template>

<script>
 
import { mapActions, mapMutations, mapState } from 'vuex'

export default {
    data() {
        return {
            name: ""
        }
    },
    computed: {
        ...mapState('helloModule', ['sum']),
        ...mapState('presonModule', ['presonList']),
    },
    methods: {

        ...mapMutations('presonModule', ['ADD_PRESON'])

    }
}
</script>

<style></style>